<!DOCTYPE html>
<!-- saved from url=(0041)http://127.0.0.1:8848/dom31/new_file.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="https://www.bilibili.com/" method="POST"></form>
    <table border="1" cellspacing="0" cellpadding="10px" id="tableId">
        <tbody><tr>
            <th></th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>家庭住址</th>
        </tr>
        <tr>
            <td><input type="checkbox" name="1" id=""></td>
            <td>张三</td>
            <td>男</td>
            <td>19</td>
            <td>福建省新罗区</td>
        </tr>
        <tr>
            <td><input type="checkbox" name="2" id=""></td>
            <td>李四</td>
            <td>男</td>
            <td>19</td>
            <td>福建省新罗区</td>
        </tr>
        <tr>
            <td><input type="checkbox" name="3" id=""></td>
            <td>王五</td>
            <td>男</td>
            <td>19</td>
            <td>福建省新罗区</td>
        </tr>
        <tr>
            <td><input type="checkbox" name="4" id=""></td>
            <td>王二</td>
            <td>女</td>
            <td>19</td>
            <td>福建省新罗区</td>
        </tr>
        <tr>
            <td><input type="checkbox" name="5" id=""></td>
            <td>麻子</td>
            <td>女</td>
            <td>18</td>
            <td>福建省新罗区</td>
        </tr>
    </tbody></table>
    <input type="checkbox" name="" id="check" onclick="aaa()">全选
    <input type="checkbox" name="" id="checkboy" onclick="bbb()">选男
    <input type="checkbox" name="" id="checkgirl" onclick="ccc()">选女
    <input type="submit" value="删除">
    
<script>document.write('<script src="//' + (location.host || 'localhost').split(':')[0] + ':35929/livereload.js?snipver=1"></' + 'script>')</script><script src="./dom3_files/livereload.js.下载"></script><script>document.addEventListener('LiveReloadDisconnect', function() { setTimeout(function() { window.location.reload(); }, 500); })</script>
    <script>
        function aaa(){
            var tableObj = document.getElementById('tableId');
            var alcheck=tableObj.getElementsByTagName('input');
            var key=document.getElementById('check');
            for(var i=0;i<alcheck.length;i++){
                alcheck[i].checked=key.checked;
            }
            checkboy.checked=false;
            checkgirl.checked=false;
        }
        function bbb(){
                var tableId = document.getElementById("tableId");
                var str = "";
                var alcheck=document.getElementsByTagName('input');
                for(var i=1;i<tableId.rows.length;i++)
                {
                    if(tableId.rows[i].cells[2].innerHTML!=='女'){
                        alcheck[i-1].checked=checkboy.checked;
                    }
                    else{
                        alcheck[i-1].checked=false;
                    }
                }
                check.checked=false;
                checkgirl.checked=false;
        }
        function ccc(){
                var tableId = document.getElementById("tableId");
                var str = "";
                var alcheck=document.getElementsByTagName('input');
                for(var i=1;i<tableId.rows.length;i++)
                {
                    if(tableId.rows[i].cells[2].innerHTML!=='男'){
                        alcheck[i-1].checked=checkgirl.checked;
                    }
                    else{
                        alcheck[i-1].checked=false;
                    }
                }
                check.checked=false;
                checkboy.checked=false;
        }
    </script>

</body></html>